package com.sbtr.open.trainingserver.dto;

import java.io.Serializable;

/**
 * <p>
 * 图像训练服务器信息
 * </p>
 *

 */
public class TrainingServerDto implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 训练服务器在线状态
	 */
	public static final String TRAINING_SERVER_STATUS_ONLINE = "online";
	/**
	 * 训练服务器离线状态
	 */
	public static final String TRAINING_SERVER_STATUS_OFFLINE = "offline";
	/**
	 * 服务器类型:训练服务器
	 */
	public static final String SERVER_TYPE_TRAINING = "training";
	/**
	 * 服务器类型:部署服务器
	 */
	public static final String SERVER_TYPE_PUBLISH = "publish";

	/**
	 * 服务器类型:数据训练服务器
	 */
	public static final String SERVER_TYPE_DATA_TRAINING = "data_training";

	/**
	 * 服务器类型:数据部署服务器
	 */
	public static final String SERVER_TYPE_DATA_PUBLISH = "data_publish";

	/**
	 * 服务器类型:部署服务器
	 */
	public static final String SERVER_TYPE_OCR_PUBLISH = "ocr_publish";

	/**
	 * 任务类型: 图像相关
	 */
	public static final String PROJECT_TYPE_IMAGE = "image";

	/**
	 * 任务类型: 数据相关
	 */
	public static final String PROJECT_TYPE_DATA = "data";

	/**
	 * 主键
	 */
	private Long id;

	/**
	 * 服务器ip
	 */
	private String ip;

	/**
	 * 服务器状态，在线、离线
	 */
	private String status;

	/**
	 * gpu服务器类型, training:训练服务器, publish:部署服务器
	 */
	private String serverType;

	/**
	 * 服务器任务类型， image: 图像, data: 数据类,
	 */
	private String projectType;

	/**
	 * 任务剩余跑完时间
	 */
	private Integer waitTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getServerType() {
		return serverType;
	}

	public void setServerType(String serverType) {
		this.serverType = serverType;
	}

	public Integer getWaitTime() {
		return waitTime;
	}

	public void setWaitTime(Integer waitTime) {
		this.waitTime = waitTime;
	}

	public String getProjectType() {
		return projectType;
	}

	public void setProjectType(String projectType) {
		this.projectType = projectType;
	}

	/**
	 * 校验当前dto的服务器状态是否合法
	 * 
	 * @return 服务器状态合法则返回true，否则返回false
	 */
	public boolean isStatusValid() {
		return TRAINING_SERVER_STATUS_ONLINE.equalsIgnoreCase(status)
				|| TRAINING_SERVER_STATUS_OFFLINE.equalsIgnoreCase(status);
	}

	/**
	 * 校验给定状态是否为合法的服务器状态
	 * 
	 * @param status
	 * @return 服务器状态合法则返回true，否则返回false
	 */
	public static boolean isStatusValid(String status) {
		return TRAINING_SERVER_STATUS_ONLINE.equalsIgnoreCase(status)
				|| TRAINING_SERVER_STATUS_OFFLINE.equalsIgnoreCase(status);
	}

}
